package cn.fanyc.action.spring.cloud.action01.controller;

import cn.fanyc.action.spring.cloud.action01.model.GoodsInfoBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * 商品管理
 *
 * @author Fanyc
 * @date 2019/12/6 22:05
 */
@RestController
@RequestMapping("/v1/goods")
public class GoodsController {

    /**
     * 获取用户信息
     *
     * @param goodsId 商品ID
     * @return 商品信息
     */
    @GetMapping("/{goodsId}")
    public GoodsInfoBean getGoodsInfo(@PathVariable("goodsId") String goodsId) {
        return new GoodsInfoBean()
                .setGoodsId(goodsId)
                .setGoodsName("测试手机")
                .setPrice(BigDecimal.valueOf(12.34));
    }
}
